package org.ysu.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.ysu.service.EChartsDataService;
import org.ysu.vo.ResultVO;

import javax.annotation.Resource;
import java.time.LocalDate;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/data")
public class EChartsDataController {
    @Resource
    EChartsDataService eChartsDataService;
    @GetMapping("/count")
    ResultVO<Map> getFormattedRegionDataOfCount(String rId){
        return ResultVO.success(eChartsDataService.getFormattedRegionDataOfCount(rId));
    }
    @GetMapping("/avgincome")
    ResultVO<Map> getFormattedRegionDataOfAvgIncome(String rId){
        return ResultVO.success(eChartsDataService.getFormattedRegionDataOfAvgIncome(rId));
    }
    @GetMapping("/resentinterview")
    ResultVO<Map> getDailyInterviewCountsOfLastSevenDays(String rId, LocalDate today){
        return  ResultVO.success(eChartsDataService.getDailyInterviewCountsOfLastSevenDays(rId,today));
    }
    @GetMapping("/admininterview")
    ResultVO<List<List<Object>>> getAdminInterviewSummaries(String rId, LocalDate startDate, LocalDate endDate){
        return  ResultVO.success(eChartsDataService.getAdminInterviewSummaries(rId, startDate, endDate));
    }
}
